package com.example.expresshelp.util;

import android.content.Context;
import android.content.SharedPreferences;

public class MyConfig {
	
	/**
     * 是否创建数据库
     * @param context
     */
    public static void setDbCreated(Context context) {
        SharedPreferences preferences = context.getSharedPreferences("createdb", Context.MODE_PRIVATE );
        SharedPreferences.Editor editor = preferences.edit();
        editor.putBoolean("flag", true);
        //提交数据
        editor.commit();
    }
    
    /**
     * 是否创建过数据库
     * @param context
     */
    public static boolean getDbCreated(Context context) {
        SharedPreferences preferences = context.getSharedPreferences("createdb", Context.MODE_PRIVATE);
        return preferences.getBoolean("flag", false);
    }
    /**
     * @param context
     */
    public static void setInited(Context context) {
        SharedPreferences preferences = context.getSharedPreferences("init", Context.MODE_PRIVATE );
        SharedPreferences.Editor editor = preferences.edit();
        editor.putBoolean("init", true);
        //提交数据
        editor.commit();
    }
    
    /**
     * @param context
     */
    public static boolean getInited(Context context) {
        SharedPreferences preferences = context.getSharedPreferences("init", Context.MODE_PRIVATE);
        return preferences.getBoolean("init", false);
    }
	
}
